import time
def read2list(file):
    file = open(file, 'r')
    v = file.readlines()
    return(v)

def bubble(C):
    for i in range(len(C)-1):
        for j in range(len(C)-2,i-1 ,-1):
            if C[i] > C[i+1]:
                C[i], C[i+1] = C[i+1], C[i]


m1 = read2list('m1_sorted.txt')
ts = time.time()
bubble(m1)
tf = time.time()
print ("m1_sorted", (tf - ts)*1000, 'milliseconds')

m2 = read2list('m2_reverse.txt')
ts2 = time.time()
bubble(m2)
tf2 = time.time()
print ("m2_reverse", (tf2 - ts2)*1000, 'milliseconds')

m3 = read2list('m3_shuffle.txt')
ts3 = time.time()
bubble(m3)
tf3 = time.time()
print ("m3_shuffle", (tf3 - ts3)*1000, 'milliseconds')
